/** @file  main.c
 *  @brief To Manupulate the Application
 * 
 *  Test Application to Test the function related to the file
 *   
 *  @author Karthik M 
 *  @bug No  bugs.
 */



#include "header.h"

int main (int argc, char *argv[] ) {
   char *line;
   int choice ;
   char *database ;


   if (argc != 2){
      fprintf (stderr, "Usage: a.out <Database name >\n");
      exit (EXIT_FAILURE);
   }

   if (! (line = (char *) malloc (sizeof(char) * MAXLINE )) )
      errno_abort (" IN MALLOC ");


   database = argv[1];
   while (1) {
      printf (" 1.read form file \n 2.write to file \n 3.exit \n");

      choice = get_num(line);

      switch (choice) {
         case 1: 
            read(database, line);
            break;
         case 2: 
            create (database, line) ;
            break ;
         case 3: 
            exit( EXIT_SUCCESS);
            break;
         default:
            printf (" Enter the Valid option!!!\n");
      }

      getchar();
      system ("clear");
   }


   do {
      free (line);
      line = NULL ;
   }while (0);




   return 0;


}
